<html>
   <head>
      <link rel="stylesheet" type="text/css" href="style.css" />
   </head>
   <body onload="">
<h2 class="comptitle">Msg File <i>src/applications/myapplication/MyMessage.msg</i></h2>
<table class="typetable">
   <tr>
      <th>Name</th>
      <th>Description</th>
   </tr>
<tr>
   <td>
      <a href="MessageType.html">MessageType</a>
      <i> (enum)</i>
   </td>
   <td>

<p>first, we declare an enum to tell the message types apart:</p>
   </td>
</tr>
<tr>
   <td>
      <a href="MyMessage.html">MyMessage</a>
      <i> (packet)</i>
   </td>
   <td>

<p>now we declare the message</p>
   </td>
</tr>
</table>
<h3 class="subtitle">Source code:</h3>
<pre class="src"><span style="color: #808080; font-style: italic; ">//
// Copyright (C) 2009 Institut fuer Telematik, Universitaet Karlsruhe (TH)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//
</span><span style="color: #000000; ">
</span><span style="color: #808080; font-style: italic; ">//
// </span><span style="color: #000080; ">@author</span><span style="color: #808080; font-style: italic; "> Antonio Zea
//
</span><span style="color: #000000; ">
</span><span style="color: #800000; font-weight: bold; ">cplusplus</span><span style="color: #000000; "> {{
#</span><span style="color: #000000; ">include</span><span style="color: #000000; "> &lt;</span><span style="color: #000000; ">TransportAddress</span><span style="color: #000000; ">.</span><span style="color: #000000; ">h</span><span style="color: #000000; ">&gt;
}}


</span><span style="color: #808080; font-style: italic; ">// import the IP Address class
</span><span style="color: #800000; font-weight: bold; ">class</span><span style="color: #000000; "> </span><span style="color: #800000; font-weight: bold; ">noncobject</span><span style="color: #000000; "> </span><span style="color: #000000; ">TransportAddress</span><span style="color: #000000; ">;

</span><span style="color: #808080; font-style: italic; ">// first, we declare an enum to tell the message types apart:
</span><span style="color: #800000; font-weight: bold; ">enum</span><span style="color: #000000; "> </span><span style="color: #000000; ">MessageType</span><span style="color: #000000; "> 
{
    </span><span style="color: #000000; ">MYMSG_PING</span><span style="color: #000000; "> = </span><span style="color: #008000; ">1</span><span style="color: #000000; ">;           </span><span style="color: #808080; font-style: italic; ">// outgoing message
</span><span style="color: #000000; ">    </span><span style="color: #000000; ">MYMSG_PONG</span><span style="color: #000000; "> = </span><span style="color: #008000; ">2</span><span style="color: #000000; ">;           </span><span style="color: #808080; font-style: italic; ">// returning message
</span><span style="color: #000000; ">}

</span><span style="color: #808080; font-style: italic; ">// now we declare the message
</span><span style="color: #800000; font-weight: bold; ">packet</span><span style="color: #000000; "> </span><span style="color: #000000; ">MyMessage</span><span style="color: #000000; "> 
{
    </span><span style="color: #000080; font-weight: bold; ">int</span><span style="color: #000000; "> </span><span style="color: #000000; ">type</span><span style="color: #000000; "> </span><span style="color: #800000; font-weight: bold; ">enum</span><span style="color: #000000; ">(</span><span style="color: #000000; ">MessageType</span><span style="color: #000000; ">);      </span><span style="color: #808080; font-style: italic; ">// message type
</span><span style="color: #000000; ">    </span><span style="color: #000000; ">TransportAddress</span><span style="color: #000000; "> </span><span style="color: #000000; ">senderAddress</span><span style="color: #000000; ">;  </span><span style="color: #808080; font-style: italic; ">// address of the node that sent the message
</span><span style="color: #000000; ">}

</span></pre>
   <hr><p class="footer"><a href="http://creativecommons.org/licenses/by-sa/3.0" target="_top"><img src="by-sa.png"></a> This documentation is released under the <a href="http://creativecommons.org/licenses/by-sa/3.0" target="_top">Creative Commons license</a></p>
   </body>
</html>
